package com.gongj.lookupMethod;

import org.springframework.beans.factory.support.MethodReplacer;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.lang.reflect.Method;

public class TestReplacedMethod implements MethodReplacer {
	@Override
	public Object reimplement(Object obj, Method method, Object[] args) throws Throwable {
		for (Object arg : args) {
			System.out.println("接受参数：" + arg);
		}
		return null;
	}

	public static void main(String[] args) {
		ClassPathXmlApplicationContext context =
				new ClassPathXmlApplicationContext("replace-method.xml");
		Replaced bean =(Replaced) context.getBean("replaced");
		bean.replacedName("gongj",88);

	}
}
